package com.xframe.xdal.config;

import com.xframe.xdal.core.constant.DataSourceTypeEnums;
import lombok.extern.log4j.Log4j2;
import org.springframework.boot.context.properties.ConfigurationPropertiesBinding;
import org.springframework.core.convert.converter.Converter;
import org.springframework.stereotype.Component;

@Log4j2
@Component
@ConfigurationPropertiesBinding
public class DataSourceTypeEnumConvert implements Converter<String, DataSourceTypeEnums> {
    @Override
    public DataSourceTypeEnums convert(String s) {
        try {
            return DataSourceTypeEnums.valueOf(s);
        } catch (Exception e) {
            e.printStackTrace();
            return DataSourceTypeEnums.Oracle;
        }
    }
}
